var path = require('path');

module.exports = function webpackConfig(config, webpack) {


  config.plugins.push(new webpack.optimize.CommonsChunkPlugin({
    name: 'common',
    minChunks: function (module, count) {
      return (
        module.resource &&
        /\.js$/.test(module.resource) &&
        module.resource.indexOf(
          path.join(__dirname, './node_modules')
        ) === 0
      )
    }
  }));


  config.output = {
    path: path.resolve(__dirname, 'dist'),
    filename: '[name].js',
    publicPath: './',
    chunkFilename: '[name].js'
  };

};
